
public class Cat {
	int CatAge;
	public Cat(String name) {
		// This constructor has only one parameter: name
		System.out.println("Cat's name is : " + name);
	}

	public void setAge(int age) {
		CatAge = age;
	}

	public int getAge() {
		System.out.println("The age of the Cat is : " + CatAge);
		return CatAge;
	}

	public static void main(String[] args) {
		/* create object */
		Cat myCat = new Cat("tommy");
		/* Set age by method */
		myCat.setAge(2);
		/* Call another method to get age */
		myCat.getAge();
		/* You can also access member variables like this */
		System.out.println("Variable value: " + myCat.CatAge);
	}
}
